On the one hand, a graphics processing unit (Graphics Processing Unit, GPU) can provide a graphics processing capability to support various graphics applications (for example, engineering drawing, high-definition videos, 3D gaming); on the other hand, the GPU can provide a general purpose computing capability to accelerate various parallel computing applications (for example, high-performance computing).
With the development of virtualization and cloud computing, an increasing quantity of data centers and physical hosts (that is, physical servers) are virtualized, and an increasing quantity of services are migrated to a virtual machine; people expect to use a GPU on a virtual machine as on a physical host, to support various GPU applications (including a graphics application and a general purpose computing application). Moreover, in a scenario of large-scale virtualization, an increasing quantity of virtual machines (Virtual Machine, VM) are deployed on a single physical host. As a quantity of VMs increases, types of operating systems of the VMs become increasingly complex.
A current technology of GPU virtualization is implemented by means of redirection of a GPU command. That is, a command of invoking a GPU command library by a GPU application is intercepted in a VM, the intercepted command is then forwarded to a host operating system (that is, Host OS), a native GPU command library of a host (Host) end is invoked in the Host OS, and the command is processed by using a GPU. However, once an operating system of the VM is different from the Host OS, the GPU command library on the VM is different from the GPU command library on the Host OS, resulting in a problem of conversion of a GPU command library. A mainstream Host OS in the industry is Linux, and at present, in a scenario of a desktop cloud that requires GPU virtualization most urgently, an operating system of a virtual machine is mostly Windows. However, GPU command libraries in Linux and Windows are greatly different. For example, for 3D rendering, Linux supports an OpenGL command library while Windows mainly supports a Direct 3D command library. For video acceleration, Linux supports a VA API command library while Windows supports a DXVA command library. These command libraries are large, and have different implementation mechanisms. It is relatively difficult to convert between the libraries, and the conversion introduces problems of an extra overhead, a delay, or even stability, causing low performance of a GPU virtualization system.